﻿CREATE TABLE [dbo].[Games] (
    [Id]             INT            IDENTITY (1, 1) NOT NULL,
    [SeasonId]       INT            NULL,
    [GameLevelId]    INT            NOT NULL,
    [BlackTeamId]    INT            NOT NULL,
    [WhiteTeamId]    INT            NOT NULL,
    [WhiteTeamGoals] INT            NOT NULL,
    [BlackTeamGoals] INT            NOT NULL,
    [GamePoints]     INT            NOT NULL,
    [InsertUser]     NVARCHAR (MAX) NOT NULL,
    [InsertDate]     DATETIME       NOT NULL,
    [UpdateUser]     NVARCHAR (MAX) NULL,
    [UpdateDate]     DATETIME       NULL,
    [Deleted]        BIT            NOT NULL,
    CONSTRAINT [PK_dbo.Games] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_Games_GameLevels] FOREIGN KEY ([GameLevelId]) REFERENCES [dbo].[GameLevels] ([Id]),
    CONSTRAINT [FK_Games_GameTeams] FOREIGN KEY ([BlackTeamId]) REFERENCES [dbo].[GameTeams] ([Id]),
    CONSTRAINT [FK_Games_GameTeams1] FOREIGN KEY ([WhiteTeamId]) REFERENCES [dbo].[GameTeams] ([Id]),
    CONSTRAINT [FK_Games_Season] FOREIGN KEY ([SeasonId]) REFERENCES [dbo].[Seasons] ([ID])
);



